package com.coderdream.chapter07.builder.a2;

public class TextBuilder extends Builder {

	private StringBuffer buffer = new StringBuffer();

	// 開始在此字段建立文件
	public void buildTitle(String title) {
		buffer.append("==================================\n");
		buffer.append("『" + title + "』\n");
		buffer.append("\n");
	}

	public void buildString(String str) {
		buffer.append('■' + " " + str + "\n");

	}

	public void buildItems(String[] items) {
		for (int i = 0; i < items.length; i++) {
			buffer.append("● " + items[i] + "\n");
		}
		buffer.append("\n");
	}

	/**
	 * 完成的文件
	 * 
	 */
	public Object buildResult() {
		buffer.append("===================================\n");// 花邊
		return buffer.toString();
	}

}
